import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '@/App'
// 登录
import Login from '@/views/login/index'
// 问题反馈
import CallBack from '@/views/callBack/index'
import SearchPageC from '@/views/callBack/components/searchPage'
import SubmitCbC from '@/views/callBack/components/submitCb'
import MyCalbackC from '@/views/callBack/components/myCallback'
import AnswerC from '@/views/callBack/components/answer'
// 我的服务
import MyService from '@/views/myService/index'
// 样例
// import Demo from '@/views/demo/index'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Login',
        component: Login,
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        children: [
            // 问题反馈
            {
                path: 'callBack',
                name: 'CallBack',
                component: CallBack,
                alias: '',
                meta: {
                    keepAlive: true,
                },
            },
            // 搜索
            {
                path: 'callBack/searchPage',
                name: 'SearchPageC',
                component: SearchPageC,
            },
            // 提交反馈
            {
                path: 'callBack/submitCb',
                name: 'SubmitCbC',
                component: SubmitCbC,
            },
            // 我的反馈
            {
                path: 'callBack/myCalback',
                name: 'MyCalbackC',
                component: MyCalbackC,
            },
            // 问题解答
            {
                path: 'callBack/answer',
                name: 'AnswerC',
                component: AnswerC,
            },
            // 我的服务
            {
                path: 'myService',
                name: 'MyService',
                component: MyService
            }
        ]
    },
    {
        path: '/demo',
        component: () => import('@/views/demo/list/index.vue'),
        // component: Demo,
        name: 'Demo',
        children: [
            // 我的服务
            {
                path: 'list',
                name: 'List',
                component: () => import('@/views/demo/list/index.vue')
            }
        ],
        props({query}){
            return {
                id: query.id,
                query: query,
                name: query.name
            }
        }
    },
]

const router = new VueRouter({
    mode: 'hash',
    routes,
})

export default router
